package com.inossem.warehousestorage_inossem.request.emergencyWarehousing;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.emergencyWarehousing.EmergencyWarehousingConfirmBean;
import com.inossem.warehousestorage_inossem.bean.emergencyWarehousing.EmergencyWarehousingSubmitBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * 作者：wsy on 2017/11/29 11:32
 * <p>
 * 邮箱：445979770@qq.com
 */

public class EmergencyWarehousingSubmitRequest extends Request {


    public static String request(Context context, EmergencyWarehousingSubmitBean bean, GsonBeanListener gsonBeanListener) {
        String tag;
        Gson gson = new Gson();
        String params = gson.toJson(bean , bean.getClass());
        String url = RequestManage.getUrl(context, RequestConstant.URL_EMERGENCY_WAREHOUSING_RECEIVE_SUBMIT );
        tag = RequestManage.getHttpsPostWithLoading(context, url,params , new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                EmergencyWarehousingConfirmBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), EmergencyWarehousingConfirmBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }
}
